home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / OpenGL / opengldoc / glspec / point_parameters.spec < prev    next >
Encoding:
Text File  |  1996-11-11  |  8.7 KB  |  264 lines

  1. Name
  2.  
  3.     SGIS_point_parameters
  4.  
  5. Name Strings
  6.  
  7.     GL_SGIS_point_parameters
  8.  
  9. Version
  10.  
  11.     $Date: 1996/04/01 23:23:08 $ $Revision: 1.1 $
  12.  
  13. Number
  14.  
  15.     54
  16.  
  17. Dependencies
  18.  
  19.      SGIS_multisample
  20.  
  21. Overview
  22.  
  23.     This extension supports additional geometric characteristics of points. It
  24.     can be used to render tiny light sources, commonly referred as "Light 
  25.     points".
  26.  
  27.     The raster brightness of a point is a function of the point area, point
  28.     color, point transparency, and the response of the display's electron gun
  29.     and phosphor. The point area and the point transparency are derived from the
  30.     point size, currently provided with the <size> parameter of glPointSize.
  31.  
  32.     The primary motivation is to allow the size of a point to be affected by
  33.     distance attenuation. When distance attenuation has an effect, the final
  34.     point size decreases as the distance of the point from the eye increases.
  35.  
  36.     The secondary motivation is a mean to control the mapping from the point
  37.     size to the raster point area and point transparency. This is done in order
  38.     to increase the dynamic range of the raster brightness of points. In other
  39.     words, the alpha component of a point may be decreased (and its transparency
  40.     increased) as its area shrinks below a defined threshold.
  41.  
  42.     This extension defines a derived point size to be closely related to point
  43.     brightness. The brightness of a point is given by:
  44.  
  45.                     1
  46.     dist_atten(d) = -------------------
  47.                     a + b * d + c * d^2
  48.  
  49.     brightness(Pe) = Brightness * dist_atten(|Pe|)
  50.  
  51.     where 'Pe' is the point in eye coordinates, and 'Brightness' is some initial 
  52.     value proportional to the square of the size provided with glPointSize. Here
  53.     we simplify the raster brightness to be a function of the rasterized point
  54.     area and point transparency.
  55.  
  56.                 brightness(Pe)            brightness(Pe) >= Threshold_Area
  57.     area(Pe) =
  58.                     Threshold_Area            Otherwise
  59.  
  60.     factor(Pe) = brightness(Pe)/Threshold_Area
  61.  
  62.     alpha(Pe) = Alpha * factor(Pe)
  63.  
  64.     where 'Alpha' comes with the point color (possibly modified by lighting).
  65.  
  66.     'Threshold_Area' above is in area units. Thus, it is proportional to the
  67.     square of the threshold provided by the programmer through this extension.
  68.  
  69.     The new point size derivation method applies to all points, while the
  70.     threshold applies to multisample points only.
  71.  
  72. Issues
  73.  
  74.     *    Does point alpha modification affect the current color ?
  75.  
  76.     No.
  77.  
  78.     *    Do we need a special function glGetPointParameterfvSGIS, or get by with
  79.     glGetFloat ?
  80.  
  81.     No.
  82.  
  83.     *    If alpha is 0, then we could toss the point before it reaches the
  84.     fragment stage.
  85.  
  86.     No.  This can be achieved with enabling the alpha test with reference of
  87.     0 and function of LEQUAL.
  88.  
  89.     *    Do we need a disable for applying the threshold ? The default threshold
  90.     value is 1.0. It is applied even if the point size is constant.
  91.  
  92.     If the default threshold is not overriden, the area of multisample
  93.     points with provided constant size of less than 1.0, is mapped to 1.0,
  94.     while the alpha component is modulated accordingly, to compensate for
  95.     the larger area. For multisample points this is not a problem, as there
  96.     are no relevant applications yet. As mentioned above, the threshold does
  97.     not apply to alias or antialias points.
  98.  
  99.     The alternative is to have a disable of threshold application, and state
  100.     that threshold (if not disabled) applies to non antialias points only
  101.     (that is, alias and multisample points).
  102.  
  103.     The behavior without an enable/disable looks fine.
  104.  
  105.     *    Future extensions (to the extension)
  106.  
  107.     1. GL_POINT_FADE_ALPHA_CLAMP_SGIS
  108.  
  109.     When the derived point size is larger than the threshold size defined by
  110.     the GL_POINT_FADE_THRESHOLD_SIZE_SGIS parameter, it might be desired to
  111.     clamp the computed alpha to a minimum value, in order to keep the point
  112.     visible. In this case the formula below change:
  113.  
  114.     factor = (derived_size/threshold)^2
  115.  
  116.                     factor                clamp <= factor 
  117.     clamped_value = 
  118.                     clamp                   factor < clamp
  119.  
  120.                  1.0                            derived_size >= threshold
  121.     alpha *=
  122.                  clamped_value                  Otherwise
  123.  
  124.     where clamp is defined by the GL_POINT_FADE_ALPHA_CLAMP_SGIS new parameter.
  125.  
  126. New Procedures and Functions
  127.  
  128.     void glPointParameterfSGIS ( GLenum pname, GLfloat param );
  129.     void glPointParameterfvSGIS ( GLenum pname, GLfloat *params );
  130.  
  131. New Tokens
  132.  
  133.     Accepted by the <pname> parameter of glPointParameterfSGIS, and the <pname>
  134.     of glGet:
  135.  
  136.     GL_POINT_SIZE_MIN_SGIS
  137.     GL_POINT_SIZE_MAX_SGIS
  138.     GL_POINT_FADE_THRESHOLD_SIZE_SGIS
  139.  
  140.     Accepted by the <pname> parameter of glPointParameterfvSGIS, and the <pname>
  141.     of glGet:
  142.  
  143.     GL_POINT_SIZE_MIN_SGIS
  144.     GL_POINT_SIZE_MAX_SGIS
  145.     GL_POINT_FADE_THRESHOLD_SIZE_SGIS
  146.     GL_DISTANCE_ATTENUATION_SGIS
  147.  
  148. Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation)
  149.  
  150.     None
  151.  
  152. Additions to Chapter 3 of the 1.0 Specification (Rasterization)
  153.  
  154.     All parameters of the glPointParameterfSGIS and glPointParameterfvSGIS
  155.     functions set various values applied to point rendering. The derived point
  156.     size is defined to be the <size> provided with glPointSize modulated with a
  157.     distance attenuation factor.
  158.  
  159.     The parameters GL_POINT_SIZE_MIN_SGIS and GL_POINT_SIZE_MAX_SGIS simply
  160.     define an upper and lower bounds respectively on the derived point size.
  161.  
  162.     The above parameters affect non multisample points as well as multisample
  163.     points, while the GL_POINT_FADE_THRESHOLD_SIZE_SGIS parameter, has no effect
  164.     on non multisample points. If the derived point size is larger than
  165.     the threshold size defined by the GL_POINT_FADE_THRESHOLD_SIZE_SGIS
  166.     parameter, the derived point size is used as the diameter of the rasterized
  167.     point, and the alpha component is intact. Otherwise, the threshold size is
  168.     set to be the diameter of the rasterized point, while the alpha component is
  169.     modulated accordingly, to compensate for the larger area.
  170.  
  171.     The distance attenuation function coefficients, namely a, b, and c in:
  172.  
  173.                     1
  174.     dist_atten(d) = -------------------
  175.                     a + b * d + c * d^2
  176.  
  177.     are defined by the <pname> parameter GL_DISTANCE_ATTENUATION_SGIS of the 
  178.     function glPointParameterfvSGIS. By default a = 1, b = 0, and c = 0.
  179.  
  180.     Let 'size' be the point size provided with glPointSize,  let 'dist' be the
  181.     distance of the point from the eye, and let 'threshold' be the threshold size 
  182.     defined by the GL_POINT_FADE_THRESHOLD_SIZE parameter of
  183.     glPointParameterfSGIS. The derived point size is given by:
  184.  
  185.     derived_size = size * sqrt(dist_atten(dist))
  186.  
  187.     Note that when default values are used, the above formula reduces to:
  188.  
  189.     derived_size = size
  190.  
  191.     the diameter of the rasterized point is given by:
  192.  
  193.                derived_size            derived_size >= threshold
  194.     diameter = 
  195.                threshold            Otherwise
  196.  
  197.     The alpha of a point is calculated to allow the fading of points instead of
  198.     shrinking them past a defined threshold size. The alpha component of the 
  199.     rasterized point is given by:
  200.  
  201.                  1                              derived_size >= threshold
  202.     alpha *=
  203.                  (derived_size/threshold)^2     Otherwise
  204.  
  205.     The threshold defined by GL_POINT_FADE_THRESHOLD_SIZE_SGIS is not clamped
  206.     to the minimum and maximum point sizes.
  207.  
  208.     Points do not affect the current color.
  209.  
  210.     This extension doesn't change the feedback or selection behavior of points.
  211.  
  212. Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations
  213. and the Framebuffer)
  214.  
  215.     None
  216.  
  217. Additions to Chapter 5 of the 1.0 Specification (Special Functions)
  218.  
  219.     None
  220.  
  221. Additions to Chapter 6 of the 1.0 Specification (State and State Requests)
  222.  
  223.     None
  224.  
  225. Additions to the GLX Specification
  226.  
  227.     None
  228.  
  229. Errors
  230.  
  231.     INVALID_ENUM is generated if PointParameterfSGIS parameter <pname> is not
  232.     GL_POINT_SIZE_MIN_SGIS, GL_POINT_SIZE_MAX_SIZE_SGIS, or
  233.     GL_POINT_FADE_THRESHOLD_SIZE_SGIS.
  234.  
  235.     INVALID_ENUM is generated if PointParameterfvSGIS parameter <pname> is not 
  236.     GL_DISTANCE_ATTENUATION_SGIS
  237.  
  238.     INVALID_VALUE is generated when values are out of range according to:
  239.  
  240.     <pname>                    valid range
  241.     --------                    -----------
  242.     GL_POINT_SIZE_MIN_SGIS            >= 0
  243.     GL_POINT_SIZE_MAX_SGIS            >= 0
  244.     GL_POINT_FADE_THRESHOLD_SIZE_SGIS        >= 0
  245.  
  246.     Issues
  247.     ------
  248.     -    should we generate INVALID_VALUE or just clamp?
  249.  
  250. New State
  251.  
  252.     Get Value                Get Command    Type    Initial Value    Attribute
  253.     ---------                -----------    ----    ---------    ---------
  254.     GL_POINT_SIZE_MIN_SGIS        GetFloatv    R    0        point
  255.     GL_POINT_SIZE_MAX_SGIS        GetFloatv    R    M        point
  256.     GL_POINT_FADE_THRESHOLD_SIZE_SGIS    GetFloatv    R    1        point
  257.     GL_DISTANCE_ATTENUATION_SGIS    GetFloatv    3xR    (1,0,0)        point
  258.  
  259. M is the largest available point size.
  260.  
  261. New Implementation Dependent State
  262.  
  263.     None
  264.